import numpy as np
import matplotlib.pyplot as plt
#支持中文
plt.rcParams['font.family'] = ['sans-serif']
plt.rcParams['font.sans-serif'] = ['SimHei']
# 支持负数
plt.rcParams['axes.unicode_minus'] = False
# 生成示例数据
data = [np.random.normal(0, std, 100) for std in range(1, 4)]


# 创建图形
plt.figure(figsize=(8, 6))
plt.boxplot(data, 
            patch_artist=True,
            labels=['Group 1', 'Group 2', 'Group 3'])


plt.title("分组数据箱线图")
plt.ylabel("数值")
plt.grid(True, linestyle=':', alpha=0.5)
plt.show()
